package com.jay.aigcoj.controller;

import com.jay.aigcoj.common.BaseResponse;
import com.jay.aigcoj.common.ResultUtils;
import com.jay.aigcoj.model.dto.chat.ChatRequest;
import com.jay.aigcoj.model.dto.chat.ChatResponse;
import com.jay.aigcoj.service.AIChatService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/chat")
public class AIChatController {

    @Resource
    private AIChatService aiChatService;

    @PostMapping("/")
    public BaseResponse<ChatResponse> chat(@RequestBody ChatRequest chatRequest, HttpServletRequest request) {
        return ResultUtils.success(aiChatService.chat(chatRequest, request));
    }
}